package com.wdd.libbase.mvp

import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleObserver
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.OnLifecycleEvent

/**
 *
 * @ProjectName:    OwnTool
 * @Package:        com.wdd.libbase.mvp
 * @ClassName:      IPresenter
 * @Description:     java类作用描述
 * @Author:         王丹丹
 * @CreateDate:     2019/12/9 11:07
 * @UpdateUser:     更新者
 * @UpdateDate:     2019/12/9 11:07
 * @UpdateRemark:   更新说明
 * @Version:        1.0
 */
interface IPresenter : LifecycleObserver {
    /**
     * 设置生命周期绑定
     */
    fun setLifecycleOwner(lifecycleOwner: LifecycleOwner?)

    @OnLifecycleEvent(Lifecycle.Event.ON_CREATE)
    fun onCreate(owner: LifecycleOwner?)

    @OnLifecycleEvent(Lifecycle.Event.ON_START)
    fun onStart(owner: LifecycleOwner?)

    @OnLifecycleEvent(Lifecycle.Event.ON_RESUME)
    fun onResume(owner: LifecycleOwner?)

    @OnLifecycleEvent(Lifecycle.Event.ON_PAUSE)
    fun onPause(owner: LifecycleOwner?)

    @OnLifecycleEvent(Lifecycle.Event.ON_STOP)
    fun onStop(owner: LifecycleOwner?)

    @OnLifecycleEvent(Lifecycle.Event.ON_DESTROY)
    fun onDestroy(owner: LifecycleOwner?)

    @OnLifecycleEvent(Lifecycle.Event.ON_ANY)
    fun onLifecycleChanged(
        owner: LifecycleOwner?,
        event: Lifecycle.Event?
    )
}